home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-09-02 | 854 b | 25 lines | [TEXT/CCL2] |
- ;;; 00 Context-free Grammar.Lisp
- ;;;
- ;;; A grammar that generates one string, viz. "Uther sleeps".
- ;;; Based on Shieber's example in Chapter, Section 3, pp. 21-22.
- ;;; It also generates two other strings (what are they?).
- ;;;
- ;;; The parser ignores anything following a semi-colon to the end of a line,
- ;;; so anything following a semi-colon is a comment to you, dear reader!
- ;;;
- ;;; Read this grammar into the parser by choosing "Eval Buffer" from the
- ;;; "Eval" menu. Then enter "(p uther sleeps)" in the Listener (and press
- ;;; Return) to parse the utterance "Uther sleeps". You should see a
- ;;; Tree Window displaying a parse tree, and an Avm Window displaying the
- ;;; the features associated with the top node in that tree.
-
-
- #[ ; this tells Lisp to beging reading a grammar.
-
- s --> np vp :.
-
- uther np:.
- sleeps vp:.
-
- #] ; end of grammar.
-